package com.example.book.mapper;

import com.example.book.model.Book;
import com.example.book.model.Member;
import com.example.book.model.Order;
import com.example.book.model.OrderBookUnion;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

@Mapper
public interface BookDaoMapper {

    /**
     * 添加会员
     * @param member
     * @return
     */
    public void addMember(Member member);

    /**
     * 查询会员
     * @param memberId
     * @return
     */
    public Member qryMember(@Param("memberId") String  memberId);

    /**
     * 提交订单
     * @param order
     */
    public void insertOrder(Order order);

    /**
     * 提交书本和定订单关联关系 1个订单多个书
     * @param orderBookUnion
     */
    public void insertOrderBookUnion(OrderBookUnion orderBookUnion);
    /**
     * 查询订单
     * 支持全查 根据会员ID 订单ID 的定向查
     * @return
     */
    public List<Order> qryOrders(Map<String,String> map);

    /**
     * 查询书籍数据
     * @param bookId
     * @return
     */
    public List<Book> qryBook(@Param("bookId")String bookId);

    /**
     * 多个id查询书籍
     * @param bookId
     * @return
     */
    public List<Book> qryBooks(@Param("bookIds")String[] bookId);

    /**
     * 修改会员积分
     * @param member
     */
   public void updateMemberScoreById(Member member);

    /**
     * 查询订单和书籍关联关系
     * @param orderId
     * @return
     */
   public List<OrderBookUnion> qryOrderBookUnions(@Param("orderId")String orderId);
}
